<!--

    Copyright © 2016-2025 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div class="color-input-container">
  <saturation-component class="saturation-component" [(color)]="control.value"></saturation-component>

  <div class="control-input-container">
    <div class="control-component">
      <!--<indicator-component class="indicator-component"
        [colorType]="presentations[presentationControl.value]"
        [color]="control.value">
      </indicator-component>-->
      <div class="color-preview">
        <div style="position:absolute; inset:0; background-image:
            linear-gradient(45deg, #ccc 25%, transparent 25%),
            linear-gradient(-45deg, #ccc 25%, transparent 25%),
            linear-gradient(45deg, transparent 75%, #ccc 75%),
            linear-gradient(-45deg, transparent 75%, #ccc 75%);
            background-size: 10px 10px; background-position: 0 0, 0 5px, 5px -5px, -5px 0;">
        </div>
        <div style="position:absolute; inset:0;" [style.background]="toRgba(control.value)"></div>
      </div>
      <div class="hue-alpha-range">
        <hue-component [(color)]="control.value"></hue-component>
        <alpha-component [(color)]="control.value"></alpha-component>
      </div>
    </div>

    <div class="color-input-block">
      <mat-select panelClass="select-panel-full-width"
                  class="presentation-select"
                  [formControl]="presentationControl">
        <mat-option [value]="0">HEX</mat-option>
        <mat-option [value]="1">RGBA</mat-option>
        <mat-option [value]="2">HSLA</mat-option>
      </mat-select>
      <div class="color-input">
        @switch (presentations[presentationControl.value]) {
          @case ('rgba') {
            <rgba-input-component label
            [(color)]="control.value"></rgba-input-component>
          }
          @case ('hsla') {
            <hsla-input-component label
            [(color)]="control.value"></hsla-input-component>
          }
          @case ('hex') {
            <tb-hex-input [(color)]="control.value"></tb-hex-input>
          }
        }
      </div>
    </div>
  </div>
</div>

<div class="color-presets-block">
  <color-presets-component class="color-presets-component" [columns]="6" [colorPresets]="colorPresets" [(color)]="control.value"></color-presets-component>
</div>
